using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Deepcode.Flux.Core.Collections;

public partial class Setup_Install_Panels_ConfirmSetup : Deepcode.Flux.Core.UI.Abstract.SetupWizardBase
{
	internal sealed class ConfirmSetupDataSource
	{
		internal sealed class ConfirmSetupDataSourceItem
		{
			private string _Title;
			private string _Value;

			public string Title { get { return _Title; } }
			public string Value { get { return _Value; } }
			public ConfirmSetupDataSourceItem(string title, string val)
			{
				_Title = title;
				_Value = val;
			}
		}

		ArrayList items = new ArrayList();
		public void AddItem(string title, string val)
		{
			ConfirmSetupDataSourceItem i = new ConfirmSetupDataSourceItem(title, val);
			items.Add(i);
		}

		public ArrayList List
		{
			get { return items; }
		}
	}

	protected override Panel Base_ErrorContainer{ get{ return this.localErrorHost; }}
	protected override Label Base_ErrorLabel { get { return this.localErrors; } }

	protected void Page_Load(object sender, EventArgs e)
	{
	}

	/// <summary>
	/// Form is being populated
	/// </summary>
	/// <param name="settings"></param>
	public override void Initialise(Deepcode.Flux.Core.Collections.BaseDictionary settings)
	{
		base.Initialise(settings);
		
		// Populate the list of settings
		BaseDictionary.DictionaryItem[] items = settings.ToArray();
		
		// Use the internal class to create data for binding in the order we want it
		ConfirmSetupDataSource s = new ConfirmSetupDataSource();
		s.AddItem("SQL Server", settings["SQLServer"]);
		s.AddItem("SQL Database", settings["SQLServerDatabase"]);
		s.AddItem("SQL Database already exists", settings["SQLDBExists"]);
		s.AddItem("SQL Authentication", settings["SQLAuthMode"]);
		if (settings["SQLAuthMode"] != "WINDOWS")
		{
			s.AddItem("SQL Username", settings["SQLServerUsername"]);
			s.AddItem("SQL Password", settings["SQLServerPassword"]);
		}
		s.AddItem("Flux login mode", settings["FluxAuthMode"]);
		if (settings["FluxAuthMode"] == "WINDOWS")
		{
			s.AddItem("Super user windows login", settings["FluxAuth_WA_Username"]);
			s.AddItem("Super user email", settings["FluxAuth_Email"]);
		}
		else
		{
			s.AddItem("Super user email", settings["FluxAuth_Email"]);
			s.AddItem("Super user password", settings["FluxAuth_FA_Password"]);
		}
		s.AddItem("Installation name", settings["ClientName"]);
		s.AddItem("Default mail server", settings["DefaultMailServer"]);
		s.AddItem("Default from address", settings["DefaultFromAddress"]);

		reviewlist.DataSource = s.List;
		reviewlist.DataBind();
	}

	/// <summary>
	/// Form is being saved
	/// </summary>
	/// <param name="settings"></param>
	/// <returns></returns>
	public override bool FinishForm(Deepcode.Flux.Core.Collections.BaseDictionary settings)
	{
		return true;
	}
}
